﻿@model zichan.Models.CreateAuthModel
@{
    ViewBag.Title = "授权添加";
    AjaxOptions ajaxOpts = new AjaxOptions { UpdateTargetId = "auth_contains",OnFailure= "OnFailure"/*,OnBegin= "OnBegin"*/ };
}
<div class="portlet">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-table"></i>授权
        </div>
        <div class="actions pull-left">
            @if (zichan.Common.PowerHelp.Check("staff", "treeauth"))
            {
                @Ajax.ActionLink("⤴返回上一页", "TreeAuth", new { Id = ViewBag.Id }, new AjaxOptions { UpdateTargetId = "auth_contains" }, new { @class = "btn default yellow-stripe" })
            }
        </div>
    </div>

    <div class="portlet-body">
        @using (Ajax.BeginForm("TreeCreateAuth", ajaxOpts))
        {
            <div class="form-body">
                @Html.HiddenFor(o => o.StaffId)
                @Html.AntiForgeryToken()

                <div class="form-group">
                    <label class="col-md-3 control-label">角色名称:</label>
                    <div class="col-md-9">
                        @Html.DropDownList("RoleId", (SelectList)ViewBag.Roles, "角色", new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessage("RoleId")
                        </span>
                    </div>
                    <input type="hidden" name="pIds" id="pIds"  />
                </div>

                <div class="form-actions">
                    <div class="row">
                        <div class="col-md-offset-3 col-md-9">
                            <button type="submit" class="btn green">提交</button>
                        </div>
                    </div>
                </div>
            </div>
        }

    </div>
</div>
@Scripts.Render("~/bundles/jqueryval")
<script>
    function OnFailure(request,error)
    {
        alert("请选择职员");
    }
    //function OnBegin()
    //{
    //    alert("1");
    //    $("#pIds").val($("#nodeIds").val());
    //}
        $(function () {
            $("#pIds").val($("#nodeIds").val());
        })
</script>
